package com.cyf.smartCity;

import com.cyf.app.network.bean.AppRegSmsReq;
import com.cyf.app.network.bean.AppRegSmsRsp;
import com.cyf.wechat.network.bean.LoginReq;
import com.cyf.wechat.network.bean.LoginRsp;
import com.cyf.wechat.service.WechatLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("微信公众号")
@RequestMapping(value = "wechatLogin")
public class WechatLoginHttpController {

    @Autowired
    private WechatLoginService wechatLoginService;
    @ApiOperation(value = "A1、发送短信验证码", notes = "调用该接口获取短信验证码")
    @PostMapping(value = "/appRegSms")
    public AppRegSmsRsp sendSms(@RequestBody AppRegSmsReq req) {
        return wechatLoginService.sendSms(req);
    }

    @ApiOperation(value = "智慧停管平台登录", notes = "调用该接口验证登录")
    @PostMapping(value = "/login")
    public LoginRsp login(@RequestBody LoginReq req) {
        return wechatLoginService.login(req);
    }
}
